import requests

url = "https://search.sina.com.cn/"

payload = {
    'q': '英雄联盟',
    'c': 'news',
    'from': 'channel',
    'ie': 'utf-8',
}
headers = {
    # 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
    # 'accept-encoding': 'gzip, deflate, br',
    # 'accept-language': 'zh-CN,zh;q=0.9',
    # 'cache-control': 'max-age=0',
    # 'cookie': 'U_TRS1=00000017.33eb75cc.61f231e0.d956dbea; UOR=www.baidu.com,blog.sina.com.cn,; SINAGLOBAL=1.202.20.170_1643262439.326974; __gads=ID=256a57c55613aa27-22fd6c573ad000db:T=1643270842:RT=1643270842:S=ALNI_MaubwlxoD_p_FR3KtQL01zF2GwWzw; SEARCH-SINA-COM-CN=; Apache=211.143.16.124_1668578886.826664; ULV=1668578929856:3:1:1:211.143.16.124_1668578886.826664:1652275092870; mYSeArcH=%u82F1%u96C4%u8054%u76DF; rotatecount=1; __bid_n=1847f3c96ce265fc0d4207; beegosessionID=f5aebeb99c70b04839f655e727713cb7',
    # 跳转之前的地址
    'referer': 'https://news.sina.com.cn/',
    # 'sec-ch-ua': '" Not;A Brand";v="99", "Google Chrome";v="97", "Chromium";v="97"',
    # 'sec-ch-ua-mobile': '?0',
    # 'sec-ch-ua-platform': '"Windows"',
    # 'sec-fetch-dest': 'document',
    # 'sec-fetch-mode': 'navigate',
    # 'sec-fetch-site': 'same-site',
    # 'sec-fetch-user': '?1',
    # https
    # 'upgrade-insecure-requests': '1',
    # 浏览器
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) '
                  'Chrome/97.0.4692.71 Safari/537.36',
}

response = requests.get(url, params=payload, headers=headers)
html = response.content.decode(encoding="utf-8")
print(html)







